// localStorage默认
/* set */
export function setCache(key,value) {
	localStorage.setItem(key, JSON.stringify(value))
}

/* get */
export function getCache(key) {
	return JSON.parse(localStorage.getItem(key))
}

/* remove one by key */
export function removeCache(key) {
	localStorage.removeItem(key)
}

/* remove this all localStorage caches */
export function clearCache() {
	localStorage.clear()
}

/* 存储临时数据 */
export function setTempCache(key,value) {
	console.log('key: '+key)
	console.log('value的长度: '+value.length)
	sessionStorage.setItem(key, JSON.stringify(value))
}

/* 取临时数据 */
export function getTempCache(key) {
	return JSON.parse(sessionStorage.getItem(key))
}

/* 移除临时数据 */
export function removeTempCache(key) {
	try	{
		sessionStorage.removeItem(key)
		
	}catch(e) {
		console.log(e)
	}
}